package com.seeyon.ctp.rest.resources;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.alibaba.fastjson.JSONObject;
import com.seeyon.apps.seepkk.manager.SeepManager;
import com.seeyon.ctp.common.AppContext;


@Path("kksyncData")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces(MediaType.APPLICATION_JSON)
public class KKSyncDataResources extends BaseResource {

	private static final Log log = LogFactory.getLog(KKSyncDataResources.class);
	private SeepManager seepManager =(SeepManager) AppContext.getBean("seepManager");
	

	
	@POST
	@Path("/syncMdmData")
	@Consumes({"application/x-www-form-urlencoded"})
	public Response syncMdmData(@Context HttpServletRequest request, @Context HttpServletResponse response){
		response.setContentType("application/text;charset=UTF-8");
	    response.setCharacterEncoding("UTF-8");
	    String data=request.getParameter("data");
	    JSONObject result=this.seepManager.syncMDMHcpData(data);
		return ok(result);
	}
}
